#include <REGX52.H>

void main(){
	int n=0;
	for(;;){
		if(!(P3&2)) continue;
		while(P3&2);
		n++; P2=~n;
	}
}